<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

    <div id="content">

    </div>

    <hr>

    <input type="button" value="发送请求" id="button">


<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script>

    var res;

    $("#button").bind("click",function () {
        console.log("点击了");
        $.ajax({
            type: 'get',
            url: 'http://localhost/getAllUsers',
            // url: 'http://10.17.19.216/getAllUsers',
            data: {
                // _method: "post",//注意是  _method，不要忘记下划线
                // username: "gumemngsxt",
                // password: "456"
            },
            datatype: "JSON",
            success: function(result){
                console.log(result);
                res = result;
                $("#content").text(result.data[0].username);
            },
            error: function(data){
                console.log("failed");
            }
        });
    })
</script>
</body>
</html>